using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//注意这个不能少

public class ChangeBtnImg : MonoBehaviour
{
    public GameObject btnObj;//定义按钮
    public Sprite before;//定义待用的按钮图标
    public Sprite behind;
    Button btn;//声明按钮

    public bool is_actived = false;

    // Start is called before the first frame update
    void Start()
    {
        btn = btnObj.GetComponent<Button>();
    }

    public void change_btn_img()
    {
        if (is_actived)
            btn.GetComponent<Image>().sprite = before;
        else
            btn.GetComponent<Image>().sprite = behind;

        is_actived = !is_actived;
    }

    // Update is called once per frame
    void Update()
    {

    }
}
